package KLTN;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.file.Files;

public class LoadTextFile {

	private String path;
	BufferedReader reader = null;
	File file;
	
	public LoadTextFile(){
		path="";
	}
	
	public String readTextFile(String path){
		
		String result="";
		String text="";
		file = new File(path);
		int index = 0;
		try {
			reader = new BufferedReader(new FileReader(file));			
			while((text = reader.readLine()) != null){						
				
				if(text.compareTo("1.0") == 0 ){
					index++;
					result = result + String.valueOf(index) +  " .Lop doi song\n";
				}
				
				if(text.compareTo("2.0") == 0){
					index++;
					result = result + String.valueOf(index) + " .Lop giai tri\n";
				}
				
				if(text.compareTo("3.0") == 0){
					index++;
					result = result + String.valueOf(index) + " .Lop kinh doanh\n";
				}
				
				if(text.compareTo("4.0") == 0){
					index++;
					result = result + String.valueOf(index) + " .Lop so hoa\n";
				}
				
				if(text.compareTo("5.0") == 0){
					index++;
					result = result + String.valueOf(index) + " .Lop the thao\n";
				}
				
			}
			
		} catch (Exception e) {
			// TODO: handle exception
		}finally{
			try {
				if (reader != null) {
		            reader.close();
		        }
			} catch (Exception e) {
				// TODO: handle exception
			}
		}
		
		return result;
	}
	
	
	
}
